<?php
if (!defined('IN_WONDERSHARE'))
{
	die('Hacking attempt');
}
class ProductsModule 
{
   var $db;
 
   function __construct()
   {
   	$this->db = $GLOBALS['db'];
   }
   function get_date_info($sql,$type = '')
   { 
   	$date = array();
	$result = $this->db->query($sql);
	if($type == 'list')
	{
	    while($row = $this->db->fetch_array($result))
		{
			
	     $row['won_product_add_time'] = empty($row['won_product_add_time'])?'':date('Y-m-d H:i',$row['won_product_add_time']);
	     $row['won_product_update_time'] = empty($row['won_product_update_time'])?'':date('Y-m-d H:i',$row['won_product_update_time']);
	     $row['won_product_add_user'] = empty($row['won_product_add_user'])?'':$row['won_product_add_user'];
	     $row['won_product_update_user'] = empty($row['won_product_update_user'])?'':$row['won_product_update_user'];
	     $row['tag'] = empty($row['tag'])?'':$row['tag'];
		 $date[] = $row;
		}
	}else
	{
		while($row = $this->db->fetch_array($result))
		{
		 $date[] = $row;
		}
	}
	return  $date;
   }
   function get_mobile_date_info($sql,$type = '')
   { 
   	$date = array();
	$result = $this->db->query($sql);
	if($type == 'list')
	{
	    while($row = $this->db->fetch_array($result))
		{
			
	     $row['m_product_add_time'] = empty($row['m_product_add_time'])?'':date('Y-m-d H:i',$row['m_product_add_time']);
	     $row['m_product_update_time'] = empty($row['m_product_update_time'])?'':date('Y-m-d H:i',$row['m_product_update_time']);
	     $row['m_product_add_user'] = empty($row['m_product_add_user'])?'':$row['m_product_add_user'];
	     $row['m_product_update_user'] = empty($row['m_product_update_user'])?'':$row['m_product_update_user'];
	     $row['tag'] = empty($row['tag'])?'':$row['tag'];
		 $date[] = $row;
		}
	}else
	{
		while($row = $this->db->fetch_array($result))
		{
		 $date[] = $row;
		}
	}
	return  $date;
   }
   function  change_info($sql)
   {
   	$affect = $this->db->query($sql);
  
   	return  $affect;
   }
   function  get_insert_id($sql)
   {
   	 $this->db->query($sql);
   	return  $this->db->insert_id();
   }
   
   function  get_sub_category($sql)
   {
   	$str = '';
	$result = $this->db->query($sql);
	while($row = $this->db->fetch_array($result))
	{
	 $str.= $row['cat_id'].',';
	}
	return  $str;
   }
   
}

?>